<template>
  <div class="chart line">
    <div class="chart-container" ref="lineChart"></div>
  </div>
</template>

<script>
export default {
  mounted() {
    this.initChart();
  },
  methods: {
    initChart() {
      const myChart = this.$echarts.init(this.$refs["lineChart"]);
      const option = {
        title: {
          text: "Line Chart",
        },
        tooltip: {
          trigger: "axis",
        },
        legend: {
          data: ["line1", "line2", "line3"],
        },
        // color: ["red", "green", "blue"],
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: {
          type: "category",
          boundaryGap: false,
          data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            name: "line1",
            type: "line",
            stack: "Total",
            // itemStyle: {
            //   color: "pink",
            // },
            // lineStyle: {
            //   color: "pink",
            // },
            data: [120, 132, 101, 134, 90, 230, 210],
          },
          {
            name: "line2",
            type: "line",
            stack: "Total",
            data: [220, 182, 191, 234, 290, 330, 310],
          },
          {
            name: "line3",
            type: "line",
            stack: "Total",
            data: [150, 232, 201, 154, 190, 330, 410],
          },
        ],
      };
      myChart.setOption(option);
    },
  },
};
</script>

<style></style>
